# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=motsa-dns-spoofing
pkgver=2.6ac6980
pkgrel=5
pkgdesc='ManOnTheSideAttack-DNS Spoofing.'
groups=('blackarch' 'blackarch-spoof' 'blackarch-networking')
arch=('any')
url='https://github.com/waytoalpit/ManOnTheSideAttack-DNS-Spoofing'
license=('custom:unknown')
depends=('python2' 'python2-scapy' 'python2')
makedepends=('git')
source=("$pkgname::git+https://github.com/waytoalpit/ManOnTheSideAttack-DNS-Spoofing.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md README.txt

  rm *.md README.txt

  cp -a * "$pkgdir/usr/share/$pkgname"

  cat > "$pkgdir/usr/bin/motsa-dnsinject" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 dnsinject.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/motsa-dnsinject"

  cat > "$pkgdir/usr/bin/motsa-dnsdetect" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 dnsdetect.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/motsa-dnsdetect"
}

